<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class UsersReg extends Model
{
    //注册网站会员
    
    protected $table = 'yds_users';

    protected $primaryKey = 'uid';

    protected $visible =[
        //白名单，可以显示，不隐藏
        'uid',
        'user_name', 
        'mobile',
        'email',
        'chubanshe', 
        'avatar_file', 
        'avatar_file_min',
        'province', 
        'city', 
        'sex', 
        'birthday',
        'shubi',
        'yukuan',
        'reg_time',
        'attrib',
        'avatar_file',
        'avatar_file_min',
        'wxopenid',
        'wxunionid'
    ]; 

    //protected $hidden = ['password', 'salt']; // 保护隐藏 
    //protected $hidden = array('password', 'salt');

    //关闭时间戳更新  'updated_at`, `created_at' 字段
    public $timestamps = false;

    //一对一关系(对应用户属性)
    public function hasOnUsersReg()
    {
        return $this->hasOne('App\Models\UsersAttrib','uid','uid');
    }
}
